
import re


magicStr = '122'
nextVal = 1
nextCountPtr = 2
while len(magicStr) < 100000:
    nextCount = int(magicStr[nextCountPtr])
    magicStr += str(nextVal) * nextCount
    nextCountPtr += 1
    nextVal = 3 - nextVal

oneCount = 0
result = [0]
with open('481.神奇字符串.array.txt', 'w') as f1:
    f1.write('vector<int> result({ 0, ')
    for i in range(100000):
        if magicStr[i] == '1':
            oneCount += 1
        f1.write(f'{oneCount}, ')
        result.append(oneCount)
        if i % 1000 == 0:
            f1.write('\n')
    f1.write('});')

print(result[11111],result[22222],result[33333],result[44444],result[99999])